#pragma once
#include"levels.hpp"
#include"util.hpp"
#include<thread>
#include<string>
//定义日志消息类
namespace logs
{
    struct LogMsg
    {
        LogMsg(loglevel::level level,
                const std::string file,
                const std::string logger,
                const std::string payload,
                size_t line)
        :_level(level)
        ,_file(file)
        ,_logger(logger)
        ,_payload(payload)
        ,_line(line)
        ,_time(util::Date::now())//复用util.hpp中的now函数实现
        ,_tid(std::this_thread::get_id())
        {
            ;
        }
    public:
        time_t _time;//日志时间
        loglevel::level _level;//日志等级,要指定类域
        std::string _file;//文件名
        size_t _line;//行号
        std::string _logger;//日志器名称
        std::string _payload;//日志消息主体
        std::thread::id _tid;//线程id
    };
};